﻿Public Class FormJLCheckRecord
    Public usr As String
    Dim objJlCheck As New clsJlCheck
    Private Sub FormJLCheckRecord_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim startDate As String = Date.Now.AddDays(-1).ToShortDateString()
        txtStartDate.Text = startDate
        Dim endDate As String = Date.Now.ToShortDateString()
        txtEndDate.Text = endDate
        setDgvData()
    End Sub

    Private Sub btnSearce_Click(sender As Object, e As EventArgs) Handles btnSearce.Click
        setDgvData()
    End Sub

    Public Sub setDgvData()
        If String.IsNullOrEmpty(txtStartDate.Text.Trim()) = False And String.IsNullOrEmpty(txtEndDate.Text.Trim()) = False Then
            Dim dtJLJC As DataTable = objJlCheck.getList(txtStartDate.Text.Trim() + " 00:00:00.000", txtEndDate.Text.Trim() + " 23:59:59.999")
            dtJLJC.Columns.Add("check_result_name")
            If dtJLJC.Rows.Count > 0 Then
                For Each row As DataRow In dtJLJC.Rows
                    If row("check_result") = "0" Then
                        row("check_result_name") = "NG"
                    Else
                        row("check_result_name") = "OK"
                    End If
                Next
            End If
            dgv.AutoGenerateColumns = False
            dgv.DataSource = dtJLJC
        Else
            MsgBox("请输入开始时间和结束时间", vbYes, "提示")
        End If
    End Sub


    Private Sub dgv_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgv.CellDoubleClick
        If e.RowIndex > -1 And e.ColumnIndex > -1 Then
            Dim sysid As String = dgv.SelectedRows(0).Cells("sys_id").Value.ToString()
            Dim frmJLCheck As New FormJLCheck()
            frmJLCheck.Sys_id = sysid
            frmJLCheck.ShowDialog(Me)
        End If
    End Sub

End Class